package com.wjm.androidnetproclient;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.wjm.androidnetproclient.okhttp.OKHttpActivity;

/**
 * 参考：https://blog.csdn.net/column/details/android-net-develop.html
 */
public class MainActivity extends AppCompatActivity {

    private Button btn_URLConnection;
    private Button btn_HttpURLConnection;
    private Button btn_HttpClient;
    private Button btn_OkHttp;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById();
    }

    private void findViewById() {
        btn_URLConnection =findViewById(R.id.btn_URLConnection);
        btn_HttpURLConnection =findViewById(R.id.btn_HttpURLConnection);

        btn_URLConnection.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,URLConnectionActivity.class));
            }
        });
        btn_HttpURLConnection.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,HttpURLConnectionActivity.class));
            }
        });
        btn_HttpClient =findViewById(R.id.btn_HttpClient);
        btn_HttpClient.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            }
        });
        btn_OkHttp =findViewById(R.id.btn_OkHttp);
        btn_OkHttp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(MainActivity.this,OKHttpActivity.class));
            }
        });
    }
}
